package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.GreFileDao;
import cn.topevery.garden.entity.po.GreFile;
import cn.topevery.garden.entity.query.GreFileQuery;
import cn.topevery.garden.entity.vo.GreFileVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 绿地/行道树/古树名木  附件表
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class GreFileLogic extends BaseLogic<GreFile> {
    @Autowired
    GreFileDao greFileDao;

    @Override
    public BaseEntityDao<GreFile, Integer> getDao() {
        return greFileDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<GreFileVO> listPage(GreFileQuery query) {
        return greFileDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        greFileDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param greFile 实体
     */
    public void saveOrUpdate(String userId, GreFile greFile){
        greFileDao.saveOrUpdate(userId,greFile);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public GreFile getEntityByColumn(String key, String value) {
        return greFileDao.getEntityByColumn(key, value);
    }

    public List<GreFile> getListByMainId(Integer mainId,Integer dataType) {
        return greFileDao.getListByMainId(mainId, dataType);
    }

    public List<GreFile> getListByMainRecordId(Integer mainId,Integer dataType) {
        return greFileDao.getListByMainRecordId(mainId, dataType);
    }

    public void insert(GreFile greFile) {
        greFileDao.insert(greFile);
    }

    public void insertList(List<GreFile> list) {
        greFileDao.insertList(list);
    }

    public void deleteByMainId(Integer mainId, Integer userId) {
        greFileDao.deleteByMainId(mainId, userId);
    }

    public void deleteByMainIds(List<String> ids, Integer userId) {
        greFileDao.deleteByMainIds(ids, userId);
    }

}
